<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="utf-8">
	<meta name="keywords" content="">
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
	<meta name="robots" content="index, follow">
	<link rel="shortcut icon" type="image/png" href="favicon.png">

	<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?9188" th:href="@{/css/bootstrap.min.css?9188}">
	<link rel="stylesheet" type="text/css" href="../static/css/style.css?8116" th:href="@{/css/style.css?8116}">
	<link rel="stylesheet" type="text/css" href="css/animate.min.css?7456" th:href="@{/css/animate.min.css?7456}">
	<link href='https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap&subset=latin,latin-ext'
		rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900&display=swap&subset=latin,latin-ext'
		rel='stylesheet' type='text/css'>
	<title>sign</title>



	<!-- Analytics -->

	<!-- Analytics END -->

</head>

<body>

	<!-- Main container -->
	<div class="page-container" id="Sign">

		<!-- bloc-0 -->
		<div class="bloc bg1 l-bloc bgc-azure" id="bloc-0">
			<div class="container bloc-sm">
				<div class="row">
					<div class="col">
						<nav th:replace="_fragments :: nav" class="navbar navbar-light row navbar-expand-md nav-invert"
							role="navigation">
							<button id="nav-toggle" type="button" class="ui-navbar-toggler navbar-toggler border-0 p-0"
								data-toggle="collapse" data-target=".navbar-27707" aria-expanded="false"
								aria-label="Toggle navigation">
								<span class="navbar-toggler-icon"></span>
							</button>
							<div class="collapse navbar-collapse navbar-27707">
								<ul class="site-navigation nav navbar-nav">
									<li class="nav-item">
										<a href="loginup.html" th:href="@{/}" class="nav-link a-btn ltc-white">首页</a>
									</li>
									<li th:if="${session.nowUser.ifHasRight(1)}" class="nav-item">
										<a href="contract/draft.html" th:href="@{/toDraft}"
											class="nav-link a-btn ltc-white">起草合同</a>
									</li>
									<li th:if="${session.nowUser.ifHasRight(5)}" class="nav-item">
										<a href="select.html" th:href="@{/toCounterSign}"
											class="nav-link a-btn ltc-white">会签合同</a>
									</li>
									<li th:if="${session.nowUser.ifHasRight(2)}" class="nav-item">
										<a href="finalization.html" th:href="@{/toFinalize}"
											class="nav-link a-btn ltc-white">定稿合同</a>
									</li>
									<li th:if="${session.nowUser.ifHasRight(6)}" class="nav-item">
										<a href="approval.html" th:href="@{/toExamine}"
											class="nav-link a-btn ltc-white">审批合同</a>
									</li>
									<li th:if="${session.nowUser.ifHasRight(7)}" class="nav-item">
										<a href="sign.html" th:href="@{/toSign}"
											class="nav-link a-btn ltc-white">签订合同</a>
									</li>
								</ul>
							</div>
							<a class="navbar-brand mr-0" style="color: white;" href="/toMe"> mcx </a>

						</nav>
					</div>
				</div>
			</div>
		</div>
		<!-- bloc-0 END -->

		<!-- bloc-15 -->
		<div class="bloc bg2 l-bloc" id="bloc-15">
			<div class="container bloc-lg">
				<div class="row">
					<div class="col text-md-left text-center">
						<div class="card">
							<div class="card-body card">
								<h1 class="mg-md">
									{{contractName}}
								</h1>
								<p>
									{{contractContent}}
								</p>
								<h5 class="mg-md">
									合同生效时间：{{beginTimeStr}}-{{endTimeStr}}
								</h5>
								<h5 class="mg-md">
									客户：{{contractCustomerName}}
								</h5>
								<h5 th:if="${file.contractid!=null}" class="mg-md">
									附件：<span th:text="${file.getFilename()}"></span>

								</h5>
								<a href="" th:if="${file.contractid!=null}"
									th:href="@{|/fileDown/${file.getFilename()}/${file.getContractid()}|}">下载附件</a>
							</div>
							<!-- bloc-16 -->
							<div class="bloc l-bloc" id="bloc-16">
								<div class="container bloc-lg">
									<div class="row">
										<div class="col text-md-left text-center">
											<div class="form-group">
												<label>
													签订意见<br>
												</label>
												<textarea class="form-control" id="textSign" rows="4"
													cols="50"></textarea>
												<button v-on:click="submitSign()"
													class="bloc-button btn btn-lg btn-block btn-azure" type="button">
													提交签订<br>
												</button>
											</div>
										</div>
									</div>
								</div>
							</div>
							<!-- bloc-16 END -->
						</div>
					</div>
				</div>
			</div>

		</div>
		<!-- bloc-15 END -->



		<!-- ScrollToTop Button -->
		<a class="bloc-button btn btn-d scrollToTop" onclick="scrollToTarget('1',this)"><svg
				xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 32 32">
				<path class="scroll-to-top-btn-icon" d="M30,22.656l-14-13-14,13" />
			</svg></a>
		<!-- ScrollToTop Button END-->


		<!-- bloc-2 -->
		<div class="bloc l-bloc" id="bloc-2">
			<div class="container bloc-lg">
				<div class="row">
					<div class="col-12">
						<h5 class="mg-md text-lg-center">
							Thank ♥ You
						</h5>
						<p class="text-lg-center">
							Renxiang Jia,2024
						</p>
					</div>
				</div>
			</div>
		</div>
		<!-- bloc-2 END -->

	</div>
	<!-- Main container END -->



	<script th:src="@{/js/jquery.min.js}" type="text/javascript" charset="utf-8"></script>
	<script th:src="@{/js/vue.js}" type="text/javascript" charset="utf-8"></script>
	<script th:src="@{/js/axios.min.js}" type="text/javascript" charset="utf-8"></script>
	<script th:inline="javascript">
		var SignVue = new Vue({
			el: "#Sign",
			data: {
				contractName: "",
				contractContent: "",
				contractCustomerName: "",
				beginTimeStr: "",
				endTimeStr: ""
			},
			mounted: function () {
				this.getInitValues();
			},
			methods: {
				getInitValues: function () {
					this.contractName = [[${ contractObject.contractname }]]
					this.contractContent = [[${ contractObject.content }]]
					this.contractCustomerName = [[${ contractObject.customerName }]]
					this.beginTimeStr = [[${ contractObject.beginTimeStr }]]
					this.endTimeStr = [[${ contractObject.endTimeStr }]]
				},

				submitSign: function () {
					var contractID = [[${ contractObject.contractid }]];
					var userID = [[${ session.nowUser.userid }]];
					var opinion = $("#textSign").val();
					axios({
						method: "post",
						url: "/contract/sign",
						params: {
							contractId: contractID,
							userId: userID,
							opinion: opinion
						}
					})
						.then(function (value) {
							if (value.data === "Operation SUCCEEDED") {
								alert("签订成功！即将返回上一级页面。");
								window.location.replace(document.referrer);
							} else {
								alert("错误：" + value.data + "，请重试。");
							}
						})
						.catch();


				}
			}
		});
	</script>

</body>

</html>